import java.util.ArrayList;
import java.util.Arrays;
import java.util.stream.Stream;

/**
 * @className: collectionToArray
 * @description:
 * @author: myself
 * @date: 2025/7/29 14:44
 * @version: 0.1
 * @since: JDK17
 */

public class collectionToArray {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>(Arrays.asList(1, 6, 5, 7, 8, 9));
        /*1.stream获取流
        * 2.mapToInt(Integer::intValue)：将包装类转换成基本数据类型
        * 3.toArray()：转换成数组*/
       /* int[] array = list.stream().mapToInt(Integer::intValue).toArray();
        for (int i : array) {
            System.out.println(i);
        }*/
        String[] s = {"123", "456", "2345"};
        Arrays.stream(s).forEach(System.out::println);
        Stream.of(s).forEach(System.out::println);
    }
}
